﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.WeixinMP.Models;
using FluentValidation;
using Microhard.WeixinMP.Msg;

namespace Microhard.WeixinMP.Validators
{
    public class ArticleModelValidator : AbstractValidator<ArtileModel>
    {
        public ArticleModelValidator()
        {
            RuleSet("Insert", () =>
            {
                RuleFor(u => u.Title).NotEmpty().WithMessage(ArticleMsg.NeedTitle);
            });
            RuleSet("Update", () =>
            {
                RuleFor(u => u.Title).NotEmpty().WithMessage(ArticleMsg.NeedTitle);
            });
        }
    }
}
